home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_100
/
106_01
/
bspat1_4.doc
< prev
next >
Wrap
Text File
|
1980-07-08
|
7KB
|
258 lines
; TITLE 'Skeleton BIOS for CP/M Version 1.4 w/ Back Space Patch'
;
MSIZE EQU 48 ; SYSTEM MEMORY SIZE IN DECIMAL K BYTES
;
;
; Features added or modified by H.R.Moran 10/2/72..10/15/79
;
; The BDOS is patched at both cold and warm boot
; to handle a backspace for a CRT properly when
; the BDOS function read console buffered is used.
; This does not intefere with the operation of anyone
; else's (e.g. MICROSOFT,XITAN,WPDAISY) trapping of
; the backspace handling. This feature is conditionally
; assembled in under control of the CRT switch.
;
; This method has one drawback. MOVCPM will not
; work properly under a system with this patch
; installed, it dies after indicating synchronization
; error. Therefore, you must keep at least one
; copy of an unpatched system around to generate
; new system sizes.
;
;
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; ! !
; ! THE LABEL 'BDOS' IN THIS EXAMPLE IS THE PLACE !
; ! YOU JUMP TO IN TURNING CONTROL OVER TO THE CCP !
; ! NOT THE BEGINNING OF CP/M AS IS THE CASE IN !
; ! SOME OTHER EXAMPLE BIOS'S. THAT IS THE 'BDOS' !
; ! IN THIS CODE IS 6 GREATER THAN THE BEGINNING !
; ! OF CP/M. !
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;
; * * * * * * * * * * * * * * * * * * * * * * * * * * * *
; * *
; * SYMBOL DEFINITIONS AND EQUATES *
; * *
; * * * * * * * * * * * * * * * * * * * * * * * * * * * *
TRUE EQU 0FFFFH
FALSE EQU NOT TRUE
;
;
BELL EQU 7 ;ring-a-ding-ding
BS EQU 8 ;BACKSPACE
TAB EQU 9 ;TAB
LF EQU 0AH ;LINEFEED
CR EQU 0DH ;CARRIAGE RETURN
;
;
CRT EQU TRUE ; CONTROLS BACKSPACE/DELETE
; (IF TRUE, RUBOUT CAUSES BACKSPACE
; IF FALSE, RUBOUT CAUSES ECHO.)
PATCH EQU MSIZE*1024-2*256 ;START OF THE CBIOS
;
ORG PATCH ;ORIGIN OF THIS PROGRAM
;
CBASE EQU (MSIZE-16)*1024 ;BIAS FOR SYSTEMS LARGER THAN 16K
CPMB EQU CBASE+2700H ;BASE OF CP/M (= BASE OF CCP)
CCP EQU CPMB ;alias
BDOS EQU CBASE+2F06H ;BASE OF RESIDENT PORTION OF CP/M
CPML EQU $-CPMB ;LENGTH OF THE CP/M SYSTEM IN BYTES
NSECTS EQU CPML/128 ;NO. OF SECTS TO LOAD ON WBOOT
;
;
; * JUMP VECTOR FOR INDIVIDUAL SUBROUTINES
;
JMP BOOT ;COLD START
WBOOTE:
JMP WBOOT ;WARM START
JMP CONST ;CONSOLE STATUS
JMP CONIN ;CONSOLE CHARACTER IN
JMP CONOUT ;CONSOLE CHARACTER OUT
JMP LIST ;LIST CHARACTER OUT
JMP PUNCH ;PUNCH CHARACTER OUT
JMP READER ;READER CHARACTER OUT
JMP HOME ;MOVE HEAD TO HOME POSITION
JMP SELDSK ;SELECT DISK
JMP SETTRK ;SET TRACK NUMBER
JMP SETSEC ;SET SECTOR NUMBER
JMP SETDMA ;SET DMA ADDRESS
JMP READ ;READ DISK
JMP WRITE ;WRITE DISK
;
BOOT:
LXI SP, 0100H ; FIRST SET UP STACK POINTER
;
; PERFORM I/O INITIALIZATION HERE, IF NESSECARY
;
LXI H, SMSG ; PRINT SIGNON MESSAGE
CALL PMSG
;
XRA A
STA IOBYTE ; CLEAR THE IOBYTE
STA CDISK ; ALSO SET THE DEFAULT DISK TO A:
;
MVI A,031H ; SELECT DRIVE A: FOR FUTURE OPERATIONS
STA SELECT
;
JMP GOCPM ;INITIALIZE AND GO TO CP/M
;
WBOOT: ; RELOAD THE OPERATING SYSTEM FROM DISK
LXI SP,0100H ; SET STACK POINTER FOR BOOTSTRAP
MVI C,0 ;SELECT DISK 0
CALL SELDSK
CALL HOME ;GO TO TRACK 00
MVI B,NSECTS ;B COUNTS THE NUMBER OF SECTORS TO LOAD
MVI C,0 ;C HAS THE CURRENT TRACK NUMBER
MVI D,2 ;D HAS THE NEXT SECTOR TO READ
;
; * NOTE THAT WE BEGIN BY READING TRACK 0, SECTOR 2 SINCE SECTOR 1 ;
; * CONTAINS THE COLD START LOADER, WHICH IS SKIPPED IN A WBOOT
;
LXI H,CPMB ;BASE OF CP/M (INITIAL LOAD POINT)
;
; * END OF LOAD OPERATION, SET PARAMETERS AND GO TO CP/M
;
GOCPM:
;
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;
; THIS IS WHERE THE PATCH IS INSTALLED IN THE BDOS
; UNDER CONDITIONAL ASSEMBLY SWITCH 'CRT'
;
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;
;
IF CRT
;PATCH BDOS TO GOTO 'MYBS' WHEN
LXI H,MYBS ;RUBOUT ENCOUNTERED AND BUFFER
SHLD BDOS+189H ;NOT EMPTY.
ENDIF
;
; **************************************************
;
; THE REST OF THIS IS NORMAL CP/M STUFF
;
; **************************************************
;
MVI A,(JMP)
STA 0 ;FOR JMP TO WBOOT
LXI H,WBOOTE ;WBOOT ENTRY POINT
SHLD 1 ;SET ADDRESS FIELD FOR JMP AT 0
;
STA 5 ;FOR JMP TO BDOS
LXI H,BDOS ;BDOS ENTRY POINT
SHLD 6 ;ADDRESS FIELD OF JUMP AT 5 TO BDOS
;
LXI B,80H ;DEFAULT DMA ADDRESS IS 80H
CALL SETDMA
;
EI ;ENABLE THE INTERRUPT SYSTEM
; ; ON GENERAL PRINCIPLES
LDA CDISK ;GET CURRENT DISK NUMBER
MOV C,A ;SEND TO THE CCP
JMP CPMB ;Give control to CCP
;
CONST: ;CONSOLE STATUS, RETURN 0FFH IF CHARACTER READY,
CONIN: ;CONSOLE CHARACTER INTO REGISTER A
CONOUT: ;CONSOLE CHARACTER OUTPUT FROM REGISTER C
LIST: ;LIST CHARACTER FROM REGISTER C
PUNCH: ;PUNCH CHARACTER FROM REGISTER C
READER: ;READ CHARACTER INTO REGISTER A FROM READER DEVICE
SELDSK: ;SELECT A DISK.
HOME: ;SEEK TO TRACK ZERO.
SETTRK: ;SELECT A TRACK
SETSEC: ;SELECT A SECTOR
SETDMA: ;SET THE DATA TRANSFER AREA ADDRESS
READ: ;READ A SECTOR
WRITE: ;WRITE A SECTOR
;
SMSG: DB CR, LF
DB MSIZE/10+'0',MSIZE MOD 10 + '0'
DB 'K CP/M VERSION 1.4 w/bs & motor ctrl', CR,LF
DB CR,LF,0
;
TRK: DB 0 ;CURRENT TRACK NUMBER.
SECT: DB 0 ;CURRENT SECTOR NUMBER.
DMAADD: DW 0 ;DISK TRANSFER ADDRESS.
DISKNO: DB 0 ;CURRENT DISK NUMBER.
;
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;
; BACKSPACE PATCH STUFF
;
; CALLED BY THE BDOS WHEN A RUBOUT IS RECOGNIZED
; AND THE LINE BUFFER IS NOT ALREADY EMPTY.
;
;
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;
; WHEN BACKING UP OVER NORMAL CHARS SEND BS,' ',BS TO CRT
; WHEN BACKING UP OVER CONTROL CHARS, SEND 2 SUCH SEQUENCES
; TO BACKUP OVER THE '^' SHOWN WITH THE CONTROL CHAR
; WHEN BACKING UP OVER TABS OR LF'S, HANDLE AS CONTROL R
;
;note: IF YOU WISH THIS TO BE DONE CONDITIONALLY
; DEPENDING ON WHETHER THE CTRL-P ECHO TO PRINTER
; IS IN EFFECT, THE FLAG FOR CTRL-P IS AT
; BDOS+300H AND IF THE LSBIT IS A 1 THEN ECHO
; TO PRINTER IS ENABLED.
;
; THE NORMAL BACKSPACE HANDLER IS AT BDOS+2E0H
; AND YOU ACCESS IT BY JUMPING TO IT, NOT CALLING
; SINCE THE CALL HAS ALREADY BEEN MADE TO THIS
; ROUTINE.
;
;ex: MYBS: PUSH B ;save BC
; MOV C,A ;save char being deleted
; LDA BDOS+2E0H
; RAR ;CY = ctrl-p flag
; MOV A,C ;restore char being deleted
; POP B ;restore BC
; JC BDOS+2E0H ;Is hardcopy on ?
; ;No
; fall thru to existing MYBS code
;
;
IF CRT
MYBS: PUSH H
LXI H,BDOS+16DH
XTHL
CALL BDOS+0CDH
JNC NOCTRL ;IS IT A CTRL CHAR EXCLUDING CR,LF,TAB ?
CALL BAKUP ;YES
;
BAKUP: PUSH B ;SEND THE BACKUP SEQUENCE BS,' ',BS
MVI C,BS
CALL CONOUT
MVI C,' '
CALL CONOUT
MVI C,BS
CALL CONOUT
POP B
PUSH H
LXI H,BDOS+1FFH ;DECREMENT BDOS'S COLUMN COUNTER
DCR M
POP H
RET
;
NOCTRL: CPI TAB
JZ DOCTRLR ;ARE WE BACKING OVER A TAB ?
CPI LF ;NO
JZ DOCTRLR ;ARE WE BACKING OVER A LF ?
JMP BAKUP ;NO, SEND 1 BACKUP SEQUENCE
;
DOCTRLR:
XTHL
LXI H,BDOS+1BFH ;CONTROL-R HANDLER
XTHL
RET
ENDIF
;
END